package com.jhanlos.flights.worldwind.texture;

import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureIO;
import java.io.File;
import javax.media.opengl.GL;

/**
 *
 * @author Marck
 */
public class TextureUtils
{
    
    public static Texture loadTexture(String fnm)
    {
        String fileName = "images/" + fnm;
        Texture tex = null;
        try
        {
            tex = TextureIO.newTexture( new File(fileName), false);
            tex.setTexParameteri(GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
            tex.setTexParameteri(GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
        }
        catch(Exception e)
        { 
            System.out.println("Error loading texture " + fileName);  
            e.printStackTrace();
        }
        
        return tex;
    }  

    
}
